home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada,comp.lang.c++
- Path: news.bton.ac.uk!je
- From: je@bton.ac.uk (John English)
- Subject: Re: on OO differnces between Ada95 and C++
- Message-ID: <DnDuA4.8GC@bton.ac.uk>
- Followup-To: comp.lang.ada,comp.lang.c++
- Organization: University of Brighton, UK
- X-Newsreader: TIN [version 1.2 PL2]
- References: <4gbq7q$g08@qualcomm.com> <Dn4J2F.uI@bton.ac.uk> <4gh204$l7n@qualcomm.com>
- Date: Mon, 26 Feb 1996 12:20:27 GMT
-
- Nasser Abbasi (nabbasi@qualcomm.com) wrote:
- : In article <Dn4J2F.uI@bton.ac.uk>, je@bton.ac.uk (John English) says:
- : >If the spec of Saving_Account has "with Account" at the beginning,
- : >"with Saving_Account" will imply "with Account".
-
- : I do not think this is true. That is the main reason I asked the
- : question in the first place. (I did not like having to "with"
- : a package that was allready with'ed by a package I am "withing" ).
-
- Hmm. I've been having another look at the visibility rules in the LRM and,
- as usual, they've made my head go round and round :-)
-
- Certainly GNAT allows you to reference Account.X if you have "with
- Saving_Account" (but I'm all too aware that GNAT /= Ada95 :-), although
- the same is not true for "use" clauses ("use Saving_Account" does not
- imply "use Account"). Remember that I'm talking about *with clauses in
- package specifications* and not use clauses *or* package bodies (in case
- there is any confusion about this).
-
- : If what you say was the case, then types defined in package "A"
- : will be seen by clients to a package "B" where "B" has with'ed A. But
- : it is not so. Clients of "B" must also 'with' "A" to see types defined
- : in "A" even though "B: has allready with'ed "A".
-
- If you're right this would be a real pain. Clients of a package would have
- to know (recursively) what other packages the spec(s) reference; if the
- spec for X "withs" a package Y so it can use type Y.T as a procedure
- parameter then you wouldn't be able to use X without Y (i.e. "with X"
- on its own would be useless; you'd have to have "with X, Y" and probably
- other things as well if Y has any "with" clauses in its specification.
-
- This is such a horrible concept that I'm inclined to believe GNAT, but
- if anyone who can understand all the subleties of the visibility rules
- can give us all a definitive explanation in words of sufficiently few
- syllables that Bears of Very Little Brain like me can understand, I for
- one would be profoundly grateful.
-
- --
- ----------------------------------------------------------------------------
- John English <je@brighton.ac.uk>, Dept. of Computing, University of Brighton
- "Disks are divided into sex and tractors..."
- ----------------------------------------------------------------------------
-